<template>
	<view class="page-content">
		<scroll-view v-if="list.length > 0" style="white-space: normal;" scroll-y>
			<div class="swiperContent pl-20 pr-20 pt-20 pb-100">

				<view class="collect-card" v-for="(collect, index) in list" :key="index" @click="goJobDetail(job)">
					<image class="collect-img" :src="baseUrl + collect.carouselImageUrls" mode="aspectFill"></image>
					<div class="collect-info">
						<div class="flex align-center">
							<div class="fontS26 collect-name text-cut">{{ collect.serveName }}</div>
							<div class="ml-auto color-red fontS24" v-if="collect.presentPrice">
								¥
								<span class=" fontS32 font-weight">{{ collect.presentPrice }}</span>
							</div>

							<div class="ml-auto color-red fontS24 flex-center" v-else>

								<span class=" fontS32 font-weight">??</span>
							</div>
						</div>
						<div class="mt-6 color-96 fontS22 text-cut">{{ collect.serveIntroduction }}</div>
					</div>

				</view>

			</div>

		</scroll-view>
		<without v-if="list.length < 1 && listLoad"></without>

	</view>
</template>

<script>
let app = getApp();
import { personalServeActionList, companyServeActionList } from '@/api/serve.js'
export default {
	computed: {
		userInfo() {
			console.log(this.$store.getters.userInfo)
			return this.$store.getters.userInfo || {};
		},
	},
	data() {
		return {
			baseUrl: getApp().globalData.baseUrl,
			list: [],
			listLoad: false,

			allLoad: false,
			noteFlag: true
		};
	},
	onPullDownRefresh() {
		uni.stopPullDownRefresh();
		this.getList()
	},

	async onLoad(opt) {
		await this.getList()
	},
	methods: {
		async tabSelect(value, index) {
			this.type = value
			await this.getList()
		},
		async getList() {
			this.listLoad = false
			let api = this.userInfo.userType === '02' ? personalServeActionList : companyServeActionList
			const { rows } = await api({
				type: 4
			})
			this.list = rows
			console.log(this.list)
			this.listLoad = true

		},
		// 跳转职位详情
		goJobDetail(item) {
			console.log(item)
			uni.navigateTo({
				url: `/pages/position/detail?positionId=${item.positionId}`
			})
		},
	}
}
</script>

<style lang="scss"></style>
